﻿#include <iostream>
using namespace std;

int main() {
	int n;

	do {
		cout << "输入n：";
		cin >> n;
	} while (n <= 0);

	int sum = 0;
	int i = 1;

	while (i <= n) {
		sum += i++;
	}

	cout << "0加到" << n << "的值为" << sum << endl;

	cin.get();
	cin.get();
}